home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_10_11
/
1011120b
< prev
next >
Wrap
Text File
|
1992-09-12
|
473b
|
29 lines
/* append.c: Append a formatted string to another string */
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
char *append(char *s, char *fmt, ...)
{
if (s && fmt)
{
va_list args;
va_start(args,fmt);
vsprintf(s+strlen(s),fmt,args);
va_end(args);
}
return s;
}
main()
{
char s[81] = "We're";
append(s," number %d!\n",1);
puts(s);
return 0;
}
Output:
We're number 1!